### Libs
import os, sys, gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk



### GUI Handler Class
class GUIHandler:
	### Initialization
	def __init__(self):
		# Load GUI definitions
        	builder = Gtk.Builder()
        	builder.add_from_file("VisualK-OS GUI.glade")
		
		# GUI callback events will be defined as class functions
		builder.connect_signals(self)
						
		# Get handle to and display the main window
		window = builder.get_object("winMain")
		window.set_title("VisualK-OS")
		window.show_all()
	
	
	
	# Standardized exit
	def exitWithCode(self,c):
		Gtk.main_quit()
		sys.exit(c)
	
	
	
	### Event handlers
	# cmdLaunchCC
	def cmdLaunchCC_clicked(self,widget):
		self.exitWithCode(3)
		
	# cmdProgEditor
	def cmdProgEditor_clicked(self,widget):
		self.exitWithCode(2)
	
	# cmdExit
	def cmdExit_clicked(self,widget):
		self.exitWithCode(1)


### Main program
if __name__ == "__main__":
	# Load/display GUI
	gd = GUIHandler()
	Gtk.main()

